//
//  BillboardTableViewCell.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "BillboardTableViewCell.h"
#import "FitHeader.h"
#import "UIImageView+WebCache.h"
@implementation BillboardTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}
- (void)createView{
    
    _coverPathImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:_coverPathImageView];
    
    _titleTopLabel = [[BaseLabel alloc]init];
    [self.contentView addSubview:_titleTopLabel];
    
    _titleCenterLabel = [[BaseLabel alloc]init];
    _titleCenterLabel.font = [UIFont systemFontOfSize:14];
    _titleCenterLabel.alpha = .7;
    [self.contentView addSubview:_titleCenterLabel];
    
    _titleBottomLabel = [[BaseLabel alloc]init];
    _titleBottomLabel.font = [UIFont systemFontOfSize:14];
    _titleBottomLabel.alpha = .7;
    [self.contentView addSubview:_titleBottomLabel];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    _coverPathImageView.frame = CGRectMake(10 * FITWidth, 10 * FITHeight, 90 * FITWidth, 100 * FITHeight);
    _titleTopLabel.frame = CGRectMake(_coverPathImageView.frame.origin.x + _coverPathImageView.frame.size.width + 10 * FITWidth, _coverPathImageView.frame.origin.y, self.contentView.frame.size.width - _coverPathImageView.frame.size.width - 20 * FITWidth, 35 * FITHeight);
    _titleCenterLabel.frame = CGRectMake(_titleTopLabel.frame.origin.x, _titleTopLabel.frame.origin.y + _titleTopLabel.frame.size.height + 5 * FITHeight, _titleTopLabel.frame.size.width, 25 * FITHeight);
    _titleBottomLabel.frame = CGRectMake(_titleCenterLabel.frame.origin.x, _titleCenterLabel.frame.origin.y + _titleCenterLabel.frame.size.height + 5 * FITHeight, _titleCenterLabel.frame.size.width, _titleCenterLabel.frame.size.height);
}
- (void)setBillBoard:(Billboard *)billBoard{
    
    [_coverPathImageView sd_setImageWithURL:[NSURL URLWithString:billBoard.coverPath]];
    _titleCenterLabel.text = [NSString stringWithFormat:@"1.%@", [billBoard.firstKResults[0] objectForKey:@"title"]];
    _titleBottomLabel.text = [NSString stringWithFormat:@"2.%@", [billBoard.firstKResults[1] objectForKey:@"title"]];
    _titleTopLabel.text = billBoard.title;
}
- (void)setBillBoard1:(Billboard *)billBoard1{
    [_coverPathImageView sd_setImageWithURL:[NSURL URLWithString:billBoard1.coverPath]];
    _titleCenterLabel.text = [NSString stringWithFormat:@"1.%@", [billBoard1.firstKResults[0] objectForKey:@"title"]];
    _titleBottomLabel.text = [NSString stringWithFormat:@"2.%@", [billBoard1.firstKResults[1] objectForKey:@"title"]];
    _titleTopLabel.text = billBoard1.title;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
